//
//  CXmppRequestMgr.h
//  wanzhaoIM
//
//  Created by liuyuantao on 15/5/29.
//  Copyright (c) 2015年 liuyuantao. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "CXmppMgr.h"
#import "AFNetworking.h"
#import "NetAndAudioModel.h"
@class CGroupModel;
@class CContactModel;
@class CMessageMgr;
@class CFileModel;
@class DownloadFileManager;
typedef void(^completeHandle)();


@interface CXmppRequestMgr : NSObject

+(CXmppRequestMgr *)shareInstance;


//用户登录时检查是否更新新版本，是否强制升级
-(void)checkVersion;

//获取服务器时间
- (void)getServerTime;

//上传头像
-(void)UploadHeadFileWithImageData:(NSData *)imageData userId:(NSString *)userId userCode:(NSString *)userCode successHandel:(void(^)(NSURLSessionDataTask *task, id responseObject))successHandle filarueHandle:(void(^)(NSURLSessionDataTask *task, NSError *error))failureHandle progressHandle:(void(^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))processHandle;
//下载头像

- (NSString *)UploadHeadFileWithUserId:(NSString *)userId;
- (NSString *)DownHeadFileWithContact:(NSString *)userId;
//上传文件、语音、图片

- (void)uploadWithContentData:(NSData *)contentData fileNmae:(NSString *)fileName userId:(NSString *)userId dataType:(NSString *)dataType fileType:(NSString *)fileType successHandel:(void(^)(NSURLSessionDataTask *task, id responseObject))successHandle filarueHandle:(void(^)(NSURLSessionDataTask *task, NSError *error))failureHandle progressHandle:(void(^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))processHandle;
//下载文件、语音、图片
- (void)downLoadeWithFileNmae:(NSString *)fileName userId:(NSString *)userId dataType:(NSString *)dataType ssuccessHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle progressHandle:(void (^)(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead))processHandle dataLenth:(NSString *)dataLenth filePath:(NSString *)filePath;
//分享下载视频
- (void)downLoadWithVideoUrl:(NSString*)url ssuccessHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle progressHandle:(void (^)(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead))processHandle filePath:(NSString *)filePath;

//群上传文件、语音、图片
- (void)uploadGroupWithContentData:(NSData *)contentData fileNmae:(NSString *)fileName groupId:(NSString *)groupId dataType:(NSString *)dataType fileType:(NSString *)fileType successHandel:(void(^)(NSURLSessionDataTask *task, id responseObject))successHandle filarueHandle:(void(^)(NSURLSessionDataTask *task, NSError *error))failureHandle progressHandle:(void(^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))processHandle;

//群下载文件、语音、图片
- (void)downLoadeGroupWithFileNmae:(NSString *)fileName GroupId:(NSString *)GroupId dataType:(NSString *)dataType successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle progressHandle:(void (^)(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead))processHandle dataLenth:(NSString *)dataLenth filePath:(NSString *)filePath;
//删除群文件
-(void)deleteGroupFileWithFileName:(NSString*)fileName GroupId:(NSString*)GroupId dataType:(NSString *)dataType successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;


- (void)getCallCenterTelePhoneNumberWithUserId:(NSString *)userId;

-(void)DownHeadFile;
-(void)getContacts;
-(void)getContactGroups;
-(void)getUserGroup;

//获取群列表
-(void)getGroupListWithUserId:(NSString *)userId;

-(void)addGroup;
-(void)addMemberToGroup;
-(void)getGroupInfo;
-(void)getGroupMembersWithGroup:(CGroupModel *)Group;

-(void)delMemberFromGroup;
-(void)delGroup;

- (void)getUserIdByUserCode:(NSString *)userCode;

//更新密码
-(void)updatePasswordWithStr:(NSString *)str;
-(void)updateSignatureWithAurograph:(NSString *)personAutograph AndCompanyId:(NSString *)companyId;
-(void)updateGroupInfo;
-(void)updateSingleUserInfoWithDic:(NSDictionary *)dic;



- (void)getCompanyPrensences;
-(void)getDeptUserTree;
-(void)getDeptUserTreeWith:(NSString*)choose;
-(void)getUserInfoWithUserId:(NSString *)userIds;
-(void)getUserRightList;
- (void)getOtherUserUpdateInfo:(NSString *)userIds;
- (void)getUpdateInfo;
- (void)getUserSettingInfo;
- (void)SetUserSettingInfoWithSettingStr:(NSString *)settingStr;

- (void)getCurUserIdWithUserCode:(NSString *)userCode;
- (void)quitLoad;
- (void)setToken;
- (void)getGroupFileListWithGroupId:(NSString *)groupId successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
- (void)updateMessageReadStatusWithMessageIds:(NSString *)messageIds messageType:(NSString *)messageType;
- (void)getOftenContact;
- (void)addOftenContactWithUserId:(NSString *)userId;
- (void)delOftenContactWithUserId:(NSString *)userId;

- (void)getDelAndDisableUserWithSuccessHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
@property (nonatomic, copy) completeHandle SuccessHandle;
//@property (nonatomic, strong) AFHTTPRequestOperation *operation;
@property (nonatomic, strong) NSMutableArray *operationArray;

@property (nonatomic, strong) NSMutableArray *contactArray;
@property (nonatomic, strong) NSMutableArray *depArray;
@property (nonatomic, strong) CMessageMgr *messageMgr;
@property (nonatomic, strong) DownloadFileManager *downMgr;
StrongProperty NSOperationQueue *shareQueue;

//xmppMessage
- (void)sendMessageWithMessage:(NSString *)message messageId:(NSString *)messageId curUser:(CContactModel *)curUser member:(CContactModel *)member group:(CGroupModel *)group;
- (void)sendFile:(CFileModel *)fileModel messageId:(NSString *)messageId curUser:(CContactModel *)curUser member:(CContactModel *)member group:(CGroupModel *)group;
- (void)sendVideoMessage:(NSData*)videoData videoImage:(UIImage*)videoImage messageId:(NSString*)messageId curUser:(CContactModel *)curUser member:(CContactModel *)member group:(CGroupModel *)group fileName:(NSString*)fileName;
- (void)sendImageMessage:(UIImage *)image messageId:(NSString *)messageId index:(NSInteger)index  curUser:(CContactModel *)curUser member:(CContactModel *)member group:(CGroupModel *)group fileName:(NSString*)fileName;
- (void)sendMapMessage:(UIImage*)mapImage messageID:(NSString*)messageId curUser:(CContactModel *)curUser member:(CContactModel *)member group:(CGroupModel *)group latitude:(double)latitude
             longitude:(double)longitude;
- (void)sendVoiceMessageWihtCurUser:(CContactModel *)curUser messageId:(NSString *)messageId member:(CContactModel *)member group:(CGroupModel *)group fileName:(NSString *)fileName timeLenth:(NSInteger)timeLenth;
- (void)sendRedPacketMessageWithMessage:(NSString *)message messageId:(NSString *) messageId curUser:(CContactModel *)curUser member:(CContactModel *) member group:(CGroupModel*)group redPacketType:(moneyType)type money:(double)money number:(NSInteger)number successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
//讨论组
- (void)creatDiscussWithGroup:(CGroupModel *)group curUser:(CContactModel *)curUser;
- (void)addDiscussMemberwithGroup:(CGroupModel *)group members:(NSArray *)members curUser:(CContactModel *)curUser;
- (void)updateDiscussInfoWithGroup:(CGroupModel *)group;
//退出讨论组
- (void)signOutDiscussWithGroup:(CGroupModel *)group curUser:(CContactModel *)curUser;
//删除讨论组
- (void)delDiscussWithGroup:(CGroupModel *)group;
//删除讨论组成员
- (void)delDiscussMembersWithGroup:(CGroupModel *)group contact:(CContactModel *)contact;

//获取企业客服
- (void)getKefuList;

//分享相关
    // 发布分享

/*type:img/text/textimg */
- (void)composeShareWithContact:(CContactModel *)contact shareId:(NSString *)shareId content:(NSString *)content type:(NSString *)type imageArray:(NSArray *)imageArray visibleUserId:(NSString *)visibleUserId successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
    //获取分享内容列表
- (AFHTTPRequestOperation *)getShareListWithDate:(NSString *)date findType:(NSString *)findType userId:(NSString *)userId releaseUserId:(NSString *)releaseUserId successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
//发布分享 text image video textimage
- (void)composeShareWithContact:(CContactModel*)contact sharId:(NSString*)shareId content:(NSString*)content type:(NSString*)type imageArray:(NSArray*)imageArray videoData:(NSData*)data visibleUseId:(NSString*)visibleUseId successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
//删除分享
- (void)delShareWithDate:(NSString *)date shareId:(NSString *)shareId successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;

//获取已删除内容ID列表
- (AFHTTPRequestOperation *)getDelShareListWithDate:(NSString *)date userId:(NSString *)userId successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
//添加回复或评论
- (void)composeShareCommentWithShareId:(NSString *)shareId commentId:(NSString *)commentId releaseUserId:(NSString *)releaseUserId sendUserId:(NSString *)sendUserId sendUserName:(NSString *)sendUserName receiveUserId:(NSString *)receiveUserId receiveUserName:(NSString *)receiveUserName content:(NSString *)content type:(NSString *)type successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;

//删除回复
- (void)delShareCommentWithCommentId:(NSString *)commentId date:(NSString *)date successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;

//点赞
- (void)praiseShareWithSendUserId:(NSString *)sendUserId commentId:(NSString *)commentId releaseUserId:(NSString *)releaseUserId contentId:(NSString *)contentId sendUserName:(NSString *)sendUserName successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
//取消点赞
- (void)cancelPraiseShareWithCommentId:(NSString *)commentId date:(NSString *)date successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
//获取回复内容
- (AFHTTPRequestOperation *)getShareCommentListWithDate:(NSString *)date shareDate:(NSString *)shareDate userId:(NSString *)userId releaseUserId:(NSString *)releaseUserId findType:(NSString *)findType successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
//获取已删除回复内容ID列表
- (AFHTTPRequestOperation *)getDelShareCommentListWithDate:(NSString *)date userId:(NSString *)userId successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
//添加我关注的人
- (void)addMineAttentionWithUserId:(NSString *)userId successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
//取消我关注的人
- (void)cancelMineAttentionWithUserId:(NSString *)userId successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
//获取关注人员列表
- (void)getMineAttentionWithsuccessHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
//获取企业信息
-(void)getCompanyInfoWithUserCode:(NSString*)userCode AndsuccessHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
//获取用户信息
-(void)getUserInfoWithUserCode:(NSString*)userCode AndsuccessHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
- (void)loadShareData;


//消息回执
- (void)sendHuiZhiXiaoxiWithMessageId:(NSString *)messageId;


//发送所有未发送成功的消息
- (void)sendUnSendMessage;


//红包相关
/*获取余额*/
-(void)getPersonbalanceWithUserId:(NSString*)userID successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
/*验证密码*/
-(void)verificationPayPasswordWithUserId:(NSString *)userId AndPassWord:(NSString*)password successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
/*修改密码*/
-(void)changePassWordWithPassword:(NSString *)password AnduserId:(NSString*)userId successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
/*充值*/
-(void)rechargeMoneyWithUserId:(NSString*)userId AndCash:(double)cash successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
/*用户抢红包信息*/
-(void)getRedPacketStatusWithUserId:(NSString*)userId AndMessageId:(NSString*)messageId successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
-(void)getMoneyFromRedPacketWithUserId:(NSString*)userId useName:(NSString*)userName messageId:(NSString*)messageId successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
/*获取所有人抢的红包金额*/
-(void)getredPacketInfoWithMessageId:(NSString*)messageId successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
/*获取微信支付签名*/
-(void)getSignWithUserId:(NSString*)userId AndMoney:(double)money AndType:(int) type successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
/*向服务器发送用户的openID*/
-(void)sendOpenIdToServerWithOpenId:(NSString*)openId AndUserId:(NSString*)userId successHandel:(void (^)(NSURLSessionDataTask *dataTask, id responseObject))successHandle filarueHandle:(void (^)(NSURLSessionDataTask *dataTask, NSError *error))failureHandle;
/*取现*/
-(void)getMoneyFromServerWithUsedId:(NSString*)usedId AndMoney:(double)money successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
/*获取交易记录*/
-(void)getMoneyListWithRecordId:(NSInteger)recordId userId:(NSString*)userId successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;
/*解除绑定openId*/
-(void)deleteOpenIdWithUserId:(NSString*)usedId  successHandel:(void (^)(AFHTTPRequestOperation *operation, id responseObject))successHandle filarueHandle:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureHandle;

@end
